package com.jeesite.modules.isys.keys.controller;

import com.jeesite.modules.isys.keys.entity.Lab;
import com.jeesite.modules.isys.keys.mapper.LabMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author XYMTOP
 * @since 2023-11-12
 */
@Controller
@RequestMapping("/mybatisplus/lab")
public class LabController {
    @Autowired
    private LabMapper labMapper;

    @RequestMapping("/all")
    public Map<String,Object> getAllLabs()
    {
        Map<String,Object> map=new HashMap<>();
        List<Lab> list=labMapper.selectList(null);
        map.put("code",200);
        map.put("data",list);
        return map;
    }

    @RequestMapping("/{labId}")
    public Map<String,Object> getLabById(@PathVariable("labId")String labId)
    {
        Map<String,Object> map=new HashMap<>();
        Lab lab=labMapper.selectById(labId);
        map.put("code",200);
        map.put("data",lab);
        return map;
    }


}
